package com.company.project.jersey.service;

import com.alibaba.fastjson.JSONObject;
import com.company.project.model.SysUser;
import com.company.project.service.SysUserService;

import javax.annotation.Resource;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

/**
 * Author: songzhonglin
 * Date: 2018/4/12
 * Time: 8:59
 * Description: 对外服务接口
 **/
@Path("/")
public class InterfaceServer {

    @Resource
    private SysUserService sysUserService;

    @Path("user/insertUser")
    @POST
    @Produces(MediaType.APPLICATION_JSON)// 返回数据的类型
    @Consumes(MediaType.APPLICATION_JSON)// 接受数据的类型
    public String insertAttractJson(SysUser sysUser) {
        JSONObject json = new JSONObject();
        sysUserService.save(sysUser);
        return json.toJSONString();
    }
}
